<?php
namespace CLUB\Controller;
use Think\Controller;
/**
* 
*/
class ActController extends PubController
{
	public function actlist(){
	   $act = M('Act');
	   $count = $act -> count();
	   $pagesize = 15;
	   $Page = new \Think\Page($count,$pagesize);// 实例化分页类 传入总记录数和每页显示的记录数
	   $list = $act->limit($Page->firstRow.','.$Page->listRows)->select();
	   $Page->setConfig('prev', '上一页');
       $Page->setConfig('next', '下一页');
	   $show = $Page -> show();
	   $this -> assign('actlist',$list);
	   $this -> assign("page",$show);
	   $this -> display();
	}
	public function addact(){
	   $this -> display();
	}
	/**
	 * 活动更新
	 * @return [type] [description]
	 */
	public function doaddact(){
		$act = M('Act');
		$act ->aname = $_POST['aname'];
		$act ->actaddress = $_POST['actaddress'];
		$act ->actp = $_POST['actp'];
		$act ->actdata = $_POST['actdata'];
		$act ->actpone = $_POST['actpone'];
		$act ->actintro = $_POST['actintro'];
		$act ->clubid = $_SESSION['clubid'];
		$act ->actpic = $this ->uploadfile($_FILES['actpic'],'./Public/upload/');
		if (false!=$act -> add()) {
			$this -> redirect("Act/actlist",'',2,"更新成功，页面跳转中...");
		}else{
			$this -> error('哎呦！出错了...');
		}
	}
}